package com.hg.transaction;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author: skh
 * @Date: 2019/9/10 14:06
 * @Description:
 */
@Service
@Slf4j
public class StudentService extends ServiceImpl<StudentMapper,Student> {


    @Transactional
    public void add() throws Exception {
        Student student = new Student();
        student.setName("skh");
        student.setScore(100);
        this.insert(student);
        throw new Exception("test");
    }

    public List<Student> list() {
        List<Student> students = this.selectList(null);

        return students;
    }
}
